//
//  GCDQG_view.m
//  DXC
//
//  Created by MC on 2017/6/2.
//  Copyright © 2017年 TOPTEAM. All rights reserved.
//

#import "GCDQG_view.h"
#import "Common.h"
@interface GCDQG_view ()


@property (weak, nonatomic) IBOutlet UIButton *btn_GCDQG2;

@property (weak, nonatomic) IBOutlet UIButton *btn_GCDQG3;


@property (nonatomic,strong)UIButton * btn_GCDQG;
@end
@implementation GCDQG_view
-(void)awakeFromNib{
    [super awakeFromNib];
    [self createUI];
}
-(instancetype)initWithFrame:(CGRect)frame{
    self  =  [super initWithFrame:frame];
    if (self) {
        [self createUI];
    }
    return self;
}
-(void)createUI{
    _btn_GCDQG=[[UIButton alloc]init];
    _btn_GCDQG.backgroundColor=[UIColor cyanColor];
    [self addSubview:_btn_GCDQG];
    [_btn_GCDQG setTitle:@"test1" forState:UIControlStateNormal];
    [_btn_GCDQG mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(100);
        make.top.equalTo(self.mas_top).offset(200);
        make.height.mas_equalTo(200);
        make.width.mas_equalTo(200);
    }];
    
    [_btn_GCDQG addTarget:self action:@selector(Btn_action:) forControlEvents:UIControlEventTouchUpInside];
    
    [_btn_GCDQG2 addTarget:self action:@selector(Btn_action:) forControlEvents:UIControlEventTouchUpInside];
    
    [_btn_GCDQG3 addTarget:self action:@selector(Btn_action:) forControlEvents:UIControlEventTouchUpInside];
    
}

-(void)Btn_action:(UIButton *)btn{
    if (btn==_btn_GCDQG) {
        if (self.block) {
            self.block(1);
        }
    }else if(btn==_btn_GCDQG2){
        if (self.block) {
            self.block(2);
        }

    }else if(btn==_btn_GCDQG3){
        if ([self.delegate respondsToSelector:@selector(action_test3)]) {
            [self.delegate action_test3];
        }
        
    }
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
